﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using ThongTin;

namespace DuLieu
{
    
    public class SinhVien_DL
    {
        KetNoi_DL ketnoi = new KetNoi_DL();
        public DataTable DanhSachSinhVien()
        {
            return ketnoi.LayDuLieu("DanhSachSinhVien");
        }
        //them sinh vien
        public int ThemSinhVien(SinhVien_TT SV)
        {
            int Nparameter = 9;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@MaSinhVien"; value[0] = SV.MaSinhVien;
            name[1] = "@TenSinhVien"; value[1] = SV.TenSinhVien;
            name[2] = "@NgaySinh"; value[2] = SV.NgaySinh;
            name[3] = "@GioiTinh"; value[3] = SV.GioiTinh;
            name[4] = "@Anh"; value[4] = SV.Anh;
            name[5] = "@Lop"; value[5] = SV.Lop;
            name[6] = "@DiaChiThuongTru"; value[6] = SV.DiaChiThuongTru;
            name[7] = "@NoiO"; value[7] = SV.NoiO;
            name[8] = "@ChinhSachUuTien"; value[8] = SV.ChinhSachUuTien;
            return ketnoi.CapNhat("ThemSinhVien", name, value, Nparameter);
        }
        //sua sinh vien
        public int SuaThongTin(SinhVien_TT SV)
        {
            int Nparameter = 9;
            string[] name = new string[Nparameter];
            object[] value = new object[Nparameter];
            name[0] = "@MaSinhVien"; value[0] = SV.MaSinhVien;
            name[1] = "@TenSinhVien"; value[1] = SV.TenSinhVien;
            name[2] = "@NgaySinh"; value[2] = SV.NgaySinh;
            name[3] = "@GioiTinh"; value[3] = SV.GioiTinh;
            name[4] = "@Anh"; value[4] = SV.Anh;
            name[5] = "@Lop"; value[5] = SV.Lop;
            name[6] = "@DiaChiThuongTru"; value[6] = SV.DiaChiThuongTru;
            name[7] = "@NoiO"; value[7] = SV.NoiO;
            name[8] = "@ChinhSachUuTien"; value[8] = SV.ChinhSachUuTien;
            return ketnoi.CapNhat("ThemSinhVien", name, value, Nparameter);
        }
    }
}
